#include <iostream>
#include <cstdio>
using namespace std;
int a[1001000];
int n, q, b;
string S;
//直接二分

int find(int x)
{
    int left=1,_right=n;
    while (left<=_right)
    {
        int mid = (left +_right) / 2;
        if(a[mid]==x) return 1;
        else if(a[mid]>x) _right = mid-1;
        else{
            left = mid + 1;
        }
    }

    return -1;
}

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    cin >> q;
    for (int i = 1; i <= q; i++)
    {
        scanf("%d", &b);
        if (find(b) != -1)
            S += 'Y';
        else
            S += 'N';
    }
    cout << S << endl;
    //system("pause");
    return 0;
}
